<!-- 新增送修-工程师-送修信息 -->
<template>
	<Card>
		<template #head>
			送修信息
		</template>
		<template #body>
			<CellItem ref="CellItem" required v-model="user" label="配送人" itemClickType="select-user"></CellItem>
			<CellField required v-model="phone" label="配送人电话"></CellField>
		</template>
	</Card>
</template>

<script>
	import Card from '@/components/card/components/cardBaseWrapper.vue'
	import { getUserData } from '@/apis/common.js'
	export default {
		components: {
			Card,
		},

		data() {
			return {
				phone: '',
				user: ''
			}
		},
		mounted() {
			let info = wx.getStorageSync('pc_userInfo')
			this.phone = info.phone
			this.user = info.id
			this.$refs.CellItem.resetInit(info.userName)
		},
		watch: {
			user: {
				handler: async function(val) {
					let res = await getUserData(val)
					if (res.code == 0) {
						this.phone = res.body.mblNo || ''
					}
				}
			}
		},
		methods: {

			validate() {
				let msg = ''
				if (this.user == '') {
					msg = '请选择配送人'
				} else if (this.phone === '') {
					msg = '配送人电话不能为空'
				} else {
					msg = ''
				}
				if (!msg) {
					return true
				}
				this.$msg(msg)
				return false



			}
		},
	}
</script>

<style lang="scss" scoped>


</style>
